//登录-用户名和密码
import request from '@/utills/request'
export const userAccountLogin = ({ account, password }) => {
    return request('/login', 'post', { account, password })
}
/**
 * 获取短信登录验证码
 * @param {String} mobile - 手机号
 * @returns Promise
 */
export const userMobileLoginMsg= ({mobile}) => {
    return request('/login/code', 'get', { mobile })
  }
  


  /**
 * 短信登录
 * @param {String} mobile - 手机号
 * @param {String} code - 验证码
 * @returns Promise
 */
export const userMobileLogin = ({ mobile, code }) => {
    return request('/login/code', 'post', { mobile, code })
  }



  //QQ登录接口
  export const userQQLogin = (unionId, source = 1) => {
    return request('/login/social', 'post', {unionId, source})
  }

  //已有账号,发送验证码
  export const userQQBindCode = (mobile) => {
    return request('/login/social/code', 'get', {mobile})
  }

  // 已有账号,进行绑定
  export const userQQBind = ({unionId, mobile, code}) => {
    return request('/login/social/bind', 'post', {unionId, mobile, code})
  }
  //校验用户名唯一性
  export const userNameOnly = (account) => {
    return request('/register/check', 'get', {account})
  }

  //qq完善信息,发送验证码
  export const userQQPatchCode = (mobile) => {
    console.log('cc',mobile);
    return request('/login/social/code', 'get', {mobile})
  }
  //qq完善信息,登录
  export const userQQPatchLogin = ({unionId, account, mobile, code, password}) => {
    return request(`/login/social/${unionId}/complement`, 'post', {account, mobile, code, password})
  }



  